﻿using System;
using System.Collections.Generic;
using System.Text;
using Cn.Cellula.Model;
using Cn.Edwon.Biz;
using System.Web.UI.WebControls;
using Cn.Cellula.Model.System;

namespace Cn.Cellula.Biz.Port {
    public interface ICodeBiz : IBiz {

        /// <summary>
        /// 增加一个新的类型
        /// </summary>
        /// <param name="eo"></param>
        /// <returns>0:添加成功，1:名字重复</returns>
        Int32 AddCodeType(TSysCodeTypeEO eo);
        /// <summary>
        /// 删除类型
        /// </summary>
        /// <param name="rKeys"></param>
        void DeleteCodeType(IList<String> rKeys);
        
        /// <summary>
        /// 根据类型key获取code列表
        /// </summary>
        /// <param name="rTypeKey"></param>
        IList<TSysCodeValueEO> LoadCodeByType(String rTypeKey);

        /// <summary>
        /// 更新代码类型，同时更新了代码值对应的TypeKey
        /// </summary>
        /// <param name="rNewEO"></param>
        /// <param name="rOldTypeKey"></param>
        int UpdateCodeType(TSysCodeTypeEO rNewEO, String rOldTypeKey);
        
        /// <summary>
        /// 更新代码值
        /// </summary>
        /// <param name="rNewEO"></param>
        /// <param name="rOldTypeKey"></param>
        int UpdateCodeValue(TSysCodeValueEO rNewEO, String rOldCodeKey);

        /// <summary>
        /// 删除code值
        /// </summary>
        /// <param name="rKeys"></param>
        void DeleteCodeValue(IList<String> rKeys);

        /// <summary>
        /// 根据名称获取type对象
        /// </summary>
        /// <param name="rName"></param>
        /// <returns></returns>
        IList<TSysCodeTypeEO> LoadCodeTypeByName(String rName);
        
        /// <summary>
        /// 根据名称获取code对象
        /// </summary>
        /// <param name="rName"></param>
        /// <returns></returns>
        IList<TSysCodeValueEO> LoadCodeValueByName(String rName);
        
        /// <summary>
        /// 类型名是否存在
        /// </summary>
        /// <param name="rName"></param>
        /// <returns></returns>
        Boolean IfTypeNameExist(String rName);

        /// <summary>
        /// 代码名是否存在
        /// </summary>
        /// <param name="rN"></param>
        /// <returns></returns>
        Boolean IfCodeNameExist(String rName);
        /// <summary>
        /// 获取代码到下拉列表集合
        /// </summary>
        /// <param name="rTypeKey"></param>
        /// <returns></returns>
        IList<ListItem> LoadCode2ListItem(String rTypeKey,Boolean rSelected);

        /// <summary>
        /// 设置类型锁
        /// </summary>
        /// <param name="keys"></param>
        /// <param name="rLock"></param>
        void SetTypeLock(IList<String> keys, bool rLock);
        /// <summary>
        /// 将Code list输出成JskitDropDownList可用的json数据
        /// </summary>
        /// <param name="rTypeKey"></param>
        /// <param name="rDefaultKey"></param>
        /// <returns></returns>
        String LoadCode2JskitDdl(String rTypeKey, String rDefaultKey);
    }
}
